#ifndef __POSSYNCTAB_H__
#define __POSSYNCTAB_H__

#include "PosSync.h"
#include "gwmessagetab.hpp"
#include "IMessageOperator.h"

/**
*@file       PosSyncTab.h
*@brief      process message
*
*@author     graywind
*@version    1.0.0.0
*@data       2012/4/23
*/

///define pointer of function
typedef void(*PosSyncTabFunc)(IMessageOperator* op, int session_id, void* pMsgBuffer, unsigned long msg_bytes);
////define message tab
typedef gwMessageTab<PosSyncTypes, MAX_POSSYNC_TYPES, PosSyncTabFunc>   PosSyncTab;
////process message
class PosSyncProcessor
{
public:
    ///@brief    process message
    ///param[in] op            operator type
    ///param[in] session_id    identifier of session
    ///param[in] pMsgBuffer    message buffer
    ///param[in] msgID         identifier of this message
    ///param[in] msg_bytes     byte length of message buffer
    ///retval    void
    static void ProcessMessage(IMessageOperator* op, int session_id, void* pMsgBuffer, unsigned long msgID, unsigned long msg_bytes)
    {
        PosSyncTab::FuncPtrArray[msgID](op, session_id, pMsgBuffer, msg_bytes);
    }
};
#endif
